package com.luhuiguo.cms.server.handler;

import org.springframework.stereotype.Component;

import com.luhuiguo.cms.shared.rpc.Login;
import com.luhuiguo.cms.shared.rpc.LoginResult;
import com.luhuiguo.gwt.dispatcher.server.ActionHandler;
import com.luhuiguo.gwt.dispatcher.server.ExecutionContext;
import com.luhuiguo.gwt.dispatcher.shared.exception.ActionException;

@Component
public class LoginHandler implements ActionHandler<Login, LoginResult> {

    @Override
    public LoginResult execute(Login action, ExecutionContext context) throws ActionException {

        // Authentication auth =
        // SecurityContextHolder.getContext().getAuthentication();
        //
        // SecurityContextHolder.clearContext();
        //
        // return new LogoutResult((User) auth.getPrincipal());
        
        return null;

    }

    @Override
    public Class<Login> getActionType() {
        return Login.class;
    }

    @Override
    public void rollback(Login action, LoginResult result, ExecutionContext context) throws ActionException {

    }

}
